import { createStore, applyMiddleware } from "redux";
import createSagaMiddleware from "redux-saga";
import rootReducers from "../reducers/RootReducers";
import rootSagas from "../sagas/";

const sagaMiddleware = createSagaMiddleware();
const middlewares = [
    sagaMiddleware
];

const configureStore = () => {
    const store = createStore(rootReducers, applyMiddleware(...middlewares));
    sagaMiddleware.run(rootSagas as any);
    return store;
};

export default configureStore();
